﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class Manage_Cargo_list : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        SqlConnection strcon = Class1.DBconnection();
        strcon.Open();
        SqlDataAdapter sda = new SqlDataAdapter("select * from tb_Cargo order by id desc",strcon);
        DataSet ds = new DataSet();
        sda.Fill(ds, "tb_Cargo");
        this.GridView1.DataSource = ds.Tables["tb_Cargo"];
        this.GridView1.DataKeyNames = new string[] { "id" };
        this.GridView1.DataBind();
    }
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {

    }
    protected void GridView1_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
    {
        string id = this.GridView1.DataKeys[e.NewSelectedIndex].Value.ToString();
        Response.Write(id);
        if (Session["bus"] == null)
        {
            System.Collections.Hashtable ht = new Hashtable();

            ht.Add(id, 1);
            Session["bus"] = ht;
            //				Session.Add("bus",ht);
        }

        else
        {
            System.Collections.Hashtable ht = (Hashtable)Session["bus"];
            if (ht[id] == null)
            {
                ht[id] = 1;
            }
            else
            {
                ht[id] = (int)ht[id] + 1;
            }
            Session["bus"] = ht;
        }

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        Response.Write(Request["Checkbox1"]);
    }

    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
    }
    protected void Button1_Click1(object sender, EventArgs e)
    {
        this.DataList1.DataSource =(Hashtable)Session["bus"];
        this.DataList1.DataBind();
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
       
    }
    protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs e)
    {

    }
    protected void Button3_Click(object sender, EventArgs e)
    {


    }
}
